home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Libris Britannia 4
/
science library(b).zip
/
science library(b)
/
PROGRAMM
/
DB_CLIPP
/
2510.ZIP
/
TRSOURCE.EXE
/
MAKEDATE.C
< prev
next >
Wrap
C/C++ Source or Header
|
1990-10-22
|
1KB
|
45 lines
/*********
* Function: MAKEDATE
*
* By: Tom Rettig
*
* Placed in the public domain by Tom Rettig Associates, 10/22/1990.
*
* Syntax: MAKEDATE( <date string> [,<months>] )
* Return: Valid <expD> of <date string>, even if <date string> is invalid date
* Empty <expD> if <date string> is not in the DTOS() format: "YYYYMMDD"
* Note : Calculates date with optional <months> if specified.
********/
#include "trlib.h"
TRTYPE makedate()
{
char *ds;
double year, month, months;
long int day;
if ( (PCOUNT==1 && ISCHAR(1)) ||
(PCOUNT==2 && ISCHAR(1) && ISNUM(2)) )
{
ds = _parc(1);
if ( ISDS(ds) )
{
/* convert to numeric values */
year = (double) DSYEAR(ds);
month = (double) DSMONTH(ds);
day = (long int) DSDAY(ds);
months = (PCOUNT==2) ? _parnd(2) : 0.0;
_retds( _tr_makedate( year, month+months, day ) );
}
else
_retds( BLANKDS );
}
else
_retds( BLANKDS );
}